package Java并发编程之美第一章;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-11-02
 * Time: 11:08
 */
public class Singleton {

    private static volatile Singleton instance;
    public static Singleton getInstance(){
        if (instance == null) {
            synchronized (Singleton.class){
                if(instance ==null){
                    instance = new Singleton();
                }
            }
        }
        return instance;
    }


}
